﻿package com.tudou.home.newskin.buttons
{
    import com.tudou.home.newskin.consts.*;
    import com.tudou.skin.common.events.*;
    import com.tudou.utils.*;
    import flash.display.*;
    import flash.events.*;
    import flash.text.*;

    public class ListItemButton extends Sprite implements ISelect
    {
        private var selectBackground:DisplayObject;
        private var title:TextField;

        public function ListItemButton(param1:String)
        {
            var _loc_2:* = NewSkinConsts.LISTITEM_WIDTH;
            var _loc_3:* = NewSkinConsts.PLAYLIST_HEIGHT;
            RectDisplayUtil.drawRect(graphics, _loc_2, _loc_3, 0);
            selectBackground = RectDisplayUtil.getShape(_loc_2, _loc_3, 16737792);
            addChild(selectBackground);
            title = TextFieldUtil.getTextField();
            title.x = 4;
            title.y = 3;
            title.text = param1;
            addChild(title);
            var _loc_4:* = new Shape();
            new Shape().graphics.lineStyle(1, 10066329, 1, true, LineScaleMode.NONE, CapsStyle.SQUARE, JointStyle.MITER);
            _loc_4.graphics.drawRect(0, 0, (_loc_2 - 1), (_loc_3 - 1));
            _loc_4.graphics.endFill();
            addChild(_loc_4);
            var _loc_5:* = RectDisplayUtil.getShape(_loc_2, _loc_3);
            addChild(_loc_5);
            this.mask = _loc_5;
            var _loc_6:Boolean = true;
            this.buttonMode = true;
            this.useHandCursor = _loc_6;
            selected = false;
            addEventListener(MouseEvent.CLICK, clickHlr);
            return;
        }// end function

        public function get selected() : Boolean
        {
            return selectBackground.visible;
        }// end function

        public function get enable() : Boolean
        {
            return true;
        }// end function

        private function clickHlr(event:MouseEvent) : void
        {
            dispatchEvent(new SelectEvent(SelectEvent.CLICK, false, false, selected));
            return;
        }// end function

        override public function get height() : Number
        {
            return NewSkinConsts.PLAYLIST_HEIGHT;
        }// end function

        public function set enable(param1:Boolean) : void
        {
            return;
        }// end function

        public function getSkin() : InteractiveObject
        {
            return this;
        }// end function

        public function set selected(param1:Boolean) : void
        {
            selectBackground.visible = param1;
            return;
        }// end function

        override public function get width() : Number
        {
            return NewSkinConsts.LISTITEM_WIDTH;
        }// end function

    }
}
